package com.kaede.game.controller;


import com.kaede.game.anotation.GameHandlerMapping;
import com.kaede.game.anotation.GameController;
import com.kaede.game.dto.CommonResponseOuterClass;
import com.kaede.game.dto.LoginRequestOuterClass;
import com.kaede.game.dto.LoginResponseOuterClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@GameController
public class TestController {

	protected Logger logger = LoggerFactory.getLogger(getClass());

	/*@GameHandlerMapping("/test")
	public Integer test() {
		System.out.println("hello framework!");
		return 10086;
	}*/

	@GameHandlerMapping("/test")
	public CommonResponseOuterClass.CommonResponse test(LoginRequestOuterClass.LoginRequest loginRequest) {
		logger.info("/test:" + loginRequest.toString());
		LoginResponseOuterClass.LoginResponse loginResponse = LoginResponseOuterClass.LoginResponse.newBuilder().setToken("asdfghjkl").build();
		CommonResponseOuterClass.CommonResponse commonResponse = CommonResponseOuterClass.CommonResponse.newBuilder().setIsSuccess(true).setData(loginResponse.toByteString()).build();
		logger.info("hello framework!");
		logger.info(commonResponse.toString());
		return commonResponse;
	}
}
